--~ with inline 20 --moves the error
without inline

include std/unittest.e
include qt/core.e as qt
include std/types.e

--~ set_test_verbosity(TEST_SHOW_ALL)

--~ object _ =  qt:init()


function from_object(object x=4.1, integer a=1, atom b=2, sequence c="3")
  return {object(a), object(b), object(c), object(x)}
end function

object oarg=5  --doh, should never have sent oarg uninitilized
test_equal( "from_object()"
        , {OBJ_INTEGER,OBJ_INTEGER,OBJ_SEQUENCE,OBJ_ATOM}
        , from_object() )
test_equal( "from_object()" --,syntax error never gets this far
        , {OBJ_INTEGER,OBJ_INTEGER,OBJ_SEQUENCE,OBJ_INTEGER}
        , from_object(oarg) )
--~ OBJ_ATOM
--~ OBJ_UNASSIGNED

--fr OBJ_UNDECLARED  


--what does undefaulted var passed uninitilized return? will never know
function u_object(object x, integer a=1, atom b=2, sequence c="3")
  return {object(a), object(b), object(c), object(x)}
end function

object uarg   --is caught uninitilized if there are no other errors
--~ test_equal( "u_object()"    --uninitilized errro can't be caught
        --~ , {OBJ_INTEGER,OBJ_INTEGER,OBJ_SEQUENCE,OBJ_UNASSIGNED}
        --~ , u_object(uarg) )


oarg= {}
test_equal( "oarg empty brace is object3", 3, object( oarg ) )
 oarg= ""
test_equal( "oarg empty quote is object3", 3, object( oarg  ) )

--fails r2856 passesw 2904 except for one sequence is unreliable empty seq
test_equal(" atom(args) args={}", 0,  atom({}) )
test_equal(" sequence(args) args={}", 1,  sequence({}) )
test_equal("object args={}", 3, object({}) )
object arg= {}
test_equal("object args={}", 3, object(arg) )
object args= {0}
test_equal("object args={0}", 3, object(args) )
 args= {{"" }} 
test_equal("object args={ }", 3, object(args) )
integer a= 0
test_equal("object integer=1", 1, object(a) )
atom n=1.1
test_equal("object integer=2", 2, object(n) )
atom ir
test_equal("object ir=0", 0, object(ir) )

test_equal("s=s 0", 0, compare("string",  "string") )  --control
test_equal("s=tr(s) 1", "string", tr("string") )
test_equal("s=tr(s) 2", 0, compare("string",  tr("string")) )

--~ test_equal("string=tr(st%1)", 0, compare("string",  tr("st%1",{"ring"})) )



test_report()
